package com.sk.sourcecircle.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sk.sourcecircle.R;
import com.sk.sourcecircle.entity.NoticeInfoBean;
import com.sk.sourcecircle.utils.MyUtils;

import java.util.List;

/**
 * Created by sk on 2018/1/1.
 */

public class MoreConsultAdapter extends BaseQuickAdapter<NoticeInfoBean.DataBean, BaseViewHolder> {

    public MoreConsultAdapter(int layoutResId, @Nullable List<NoticeInfoBean.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, NoticeInfoBean.DataBean item) {
        String tvTime = MyUtils.getTimeFormatText(item.getCreate_time());
        helper.setText(R.id.tv_title, item.getTitle())
                .setText(R.id.tv_location, item.getCommunity_name() + "  资讯")
                .setText(R.id.tv_info, tvTime + "   " + item.getShow() + "人看   " + item.getComment() + "评论");
        Glide.with(mContext).load(item.getHead_url()).into((ImageView) helper.getView(R.id.item_bg));

        ImageView imageView = helper.getView(R.id.vip);
        switch (item.getCommunity_type()){
            case 1:
                imageView.setVisibility(View.VISIBLE);
                imageView.setImageResource(R.mipmap.group_vip);
                break;
            case 2:
                imageView.setVisibility(View.VISIBLE);
                imageView.setImageResource(R.mipmap.vip_icon);
                break;
            case 3:
                imageView.setVisibility(View.VISIBLE);
                imageView.setImageResource(R.mipmap.person_vip);
                break;
        }

    }
}
